import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/// @author: sunlunchang
/// 主题工具类，用户获取一些常用的组件和配置
class ThemeUtil {
  ///////////////////// 边框 ///////////////////////
  //获取一个圆角
  static BorderRadius getBrRadius(double? radius) {
    return BorderRadius.all(Radius.circular(radius ?? 0));
  }

  //获取一个SizedBox

  ///////////////////// 视觉密度 ///////////////////////
  // 拥挤的视觉密度
  static const VisualDensity crowdedDensity = VisualDensity(horizontal: -3, vertical: -3);

  // 最小的视觉密度
  static const VisualDensity minimumDensity = VisualDensity(
      horizontal: VisualDensity.minimumDensity, vertical: VisualDensity.minimumDensity);

  ///////////////////// SizedBox ///////////////////////

  // 标准的视觉密度盒子
  static SizedBox getBoxStandard(
      {Key? key, Widget? child, double? coverWidth, double? coverHeight}) {
    return getSquareBox(48, key: key, child: child);
  }

  // 舒适的视觉密度盒子
  static SizedBox getBoxComfortable(
      {Key? key, Widget? child, double? coverWidth, double? coverHeight}) {
    return getSquareBox(44, key: key, child: child);
  }

  // 紧凑的视觉密度盒子
  static SizedBox getBoxCompact(
      {Key? key, Widget? child, double? coverWidth, double? coverHeight}) {
    return getSquareBox(40, key: key, child: child);
  }

  // 拥挤的视觉密度盒子
  static SizedBox getBoxCrowded(
      {Key? key, Widget? child, double? coverWidth, double? coverHeight}) {
    return getSquareBox(36, key: key, child: child);
  }

  // 最小的视觉密度盒子
  static SizedBox getBoxMinimum(
      {Key? key, Widget? child, double? coverWidth, double? coverHeight}) {
    return getSquareBox(32, key: key, child: child);
  }

  // 获取一个正方形盒子
  static SizedBox getSquareBox(double size, {Key? key, Widget? child}) {
    return SizedBox.fromSize(key: key, size: Size(size, size));
  }

  // 获取一个SizedBox 仅仅具备大小 可用于占位
  static SizedBox getSizedBox({Key? key, double width = 0, double height = 0}) {
    return SizedBox.fromSize(key: key, size: Size(width, height));
  }
}
